'\" te
.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.Dd April 29, 2019
.Dt KBD 1
.Os
.Sh NAME
.Nm kbd
.Nd
manipulate the state of keyboard, or display the type of keyboard, or
change the default keyboard abort sequence effect
.Sh SYNOPSIS
.Nm
.Op Fl r
.Op Fl t
.Op Fl l
.Op Fl a Ar enable | Ar disable | Ar alternate
.Op Fl c Ar on | Ar off
.Op Fl d Ar keyboard device
.Op Fl A Ar autorepeat count
.Op Fl D Ar autorepeat delay
.Op Fl R Ar autorepeat rate
.Nm
.Op Fl i
.Op Fl d Ar keyboard device
.Nm
.Fl s Op Ar language
.Nm
.Fl b Op Ar keyboard | Ar console
.Ar frequency
.Sh DESCRIPTION
The
.Nm
utility manipulates the state of the keyboard, or displays the
keyboard type, or allows the default keyboard abort sequence effect to be
changed.
The abort sequence also applies to serial console devices.
The
.Nm
utility sets the
.Pa /dev/kbd
default keyboard device.
.Sh EXTENDED DESCRIPTION
The
.Fl i
option reads and processes default values for the keyclick and
keyboard abort settings from the keyboard configuration service,
.Sy svc:/system/keymap:default .
Only keyboards that support a clicker respond to the
.Fl c
option.
.Pp
The keyboard abort sequence effect can only be changed by a super-user using
the
.Fl a
option.
This sequence is typically Stop-A or L1-A and Shift-Pause on the keyboard on
.Sy SPARC
systems, F1-A and Shift-Pause on x86 systems,
and BREAK on the serial console input device on most systems.
.Pp
A
.Sy BREAK
condition that originates from an erroneous electrical signal
cannot be distinguished from one deliberately sent by remote
.Sy DCE .
As a remedy, use the
.Fl a
option with Alternate Break to switch break interpretation.
Due to the risk of incorrect sequence interpretation, binary
protocols such as
.Sy SLIP
and others should not be run over the serial console port when Alternate Break
sequence is in effect.
.Pp
Although PPP is a binary protocol, it has the ability to avoid using characters
that interfere with serial operation.
The default alternate break sequence is
CTRL-m
.Sy ~
CTRL-b, or
.Sy 0D 7E 02
in hexadecimal.
In PPP, this can be avoided by setting either
.Sy 0x00000004
or
.Sy 0x00002000
in the ACCM.
This forces an escape for the CTRL-b or CTRL-m characters, respectively.
.Pp
To do this in Solaris PPP 4.0, add:
.Pp
.Dl asyncmap 0x00002000
.Pp
to the
.Pa /etc/ppp/options
file or any of the other configuration files used for the connection.
See
.Xr pppd 8 .
.Pp
SLIP has no comparable capability, and must not be used if the Alternate Break
sequence is in use.
.Pp
The Alternate Break sequence has no effect on the keyboard abort.
For more information on the Alternate Break sequence, see
.Xr zs 4D ,
.Xr se 4D ,
and
.Xr asy 4D .
.Pp
On many systems, the default effect of the keyboard abort sequence is to
suspend the operating system and enter the debugger or the monitor.
Some systems feature key switches with a
.Sy secure
position.
On these systems, setting the key switch to the
.Sy secure
position overrides any software default set with this command.
.Sh OPTIONS
The following options are suported:
.Bl -hang
.It Fl a Ar enable | Ar disable | Ar alternate
.Pp
Enables, disables, or alternates the keyboard abort sequence effect.
By default, a keyboard abort sequence suspends the operating system on most
systems.
This sequence is typically
.Sy Stop-A
or
.Sy L1-A
and
.Sy Shift-Pause
on the keyboard on
.Sy SPARC
systems,
.Sy F1-A
and
.Sy Shift-Pause
on x86 systems, and
.Sy BREAK
on the serial console device.
.Pp
The default keyboard behavior can be changed using this option.
The
.Fl a
option can only be used by a super-user.
.Bl -hang
.It Ar enable
Enables the default effect of the keyboard abort sequence (suspend the
operating system and enter the debugger or the monitor).
.It Ar disable
Disables the default/alternate effect and ignores keyboard abort sequences.
.It Ar alternate
Enables the alternate effect of the keyboard abort sequences (suspend the
operating system and enter the debugger or the monitor) upon receiving the
Alternate Break character sequence on the console.
The Alternate Break sequence is defined by the drivers
.Xr asy 4D ,
.Xr se 4D ,
.Xr zs 4D .
Due to a risk of incorrect sequence interpretation, binary protocols cannot be
run over the serial console port when this value is used.
.El
.It Fl A Ar count
.Pp
Sets autorepeat count.
Value
.Sy -1
denotes unlimited autorepeat (default).
.It Fl b Ar keyboard | Ar console
.Pp
Sets the beeper frequency for keyboard or console.
.Bl -hang
.It Ar keyboard
Set the keyboard beeper frequency to the operand in HZ.
See
.Sx OPERANDS .
.It Ar console
Sets the console beeper frequency to the operand in HZ.
See
.Sx OPERANDS .
.El
.It Fl c Ar on | Ar off
.Pp
Turns the clicking of the keyboard on or off.
.Bl -hang
.It Ar on
Enables clicking
.It Ar off
Disables clicking
.El
.It Fl d Ar keyboard device
.Pp
Specifies the keyboard device being set.
The default setting is
.Pa /dev/kbd .
.It Fl D Ar autorepeat delay
.Pp
Sets the autorepeat delay in milliseconds.
.It Fl i
.Pp
Sets keyboard properties from the keyboard default file.
With the exception of
.Fl d Ar keyboard device ,
this option cannot be used with any other option.
The
.Fl i
option instructs the keyboard command to read and process
keyclick and keyboard abort default values from the keyboard configuration
service,
.Sy svc:/system/keymap:default .
The
.Fl i
option can only be used by a user or role with the
.Sy Device Security Rights Profile .
.It Fl l
.Pp
Returns the layout code of the keyboard being used, and the autorepeat delay
and autorepeat rate being used.
.Pp
If used with
.Fl R
or
.Fl D
option, this option returns the value before the changes.
.It Fl r
Resets the keyboard as if power-up.
.It Fl R Ar autorepeat rate
.Pp
Sets the autorepeat rate in milliseconds.
.It Fl s Op Ar language
.Pp
Sets the keyboard layout into the kernel.
.Pp
If
.Ar language
is specified, the layout is set to
.Ar language ,
and
.Xr loadkeys 1
runs implicitly.
If
.Ar language
is not specified, a list of available layouts are presented, prompting for the
user to specify the
.Ar language .
See
.Sx OPERANDS .
.It Fl t
.Pp
Returns the type of the keyboard being used.
.El
.Sh OPERANDS
The following operands are supported:
.Bl -hang
.It Ar frequency
The frequency value specified to be set in kernel.
The receiver of this value is specified by the
.Fl b
option.
This value should be between 0 and 32767 otherwise will be ejected with
.Sy EINVAL .
.It Ar language
The language specified to be set in kernel.
If the language is not found, the languages supported are listed for selection.
It only applies to
.Fl s
option.
.El
.Sh FILES
.Bl -ohang
.It Pa /dev/kbd
Keyboard device file.
.El
.Sh EXAMPLES
.Bl -ohang
.It Sy Example 1 Displaying the Keyboard Type
.Pp
The following example displays the keyboard type:
.Pp
.Dl example% kbd -t
.Dl Type 4 Sun keyboard
.Dl example%
.El
.Bl -ohang
.It Sy Example 2 Setting Keyboard Defaults
.Pp
The following example sets the keyboard defaults as specified in the keyboard
default file:
.Pp
.Dl example# kbd -i
.Dl example#
.El
.Bl -ohang
.It Sy Example 3 Displaying Information
.Pp
The following example displays keyboard type and layout code.
It also displays auto repeat delay, rate and count settings.
.Pp
.Dl example% kbd -l
.Dl type=6
.Dl layout=274 (0x112)
.Dl delay(ms)=500
.Dl rate(ms)=40
.Dl count=unlimited
.Dl example%
.El
.Bl -ohang
.It Sy Example 4 Setting Keyboard Autorepeat Delay
.Pp
The following example sets the keyboard autorepeat delay:
.Pp
.Dl example% kbd -D 300
.Dl example%
.El
.Bl -ohang
.It Sy Example 5 Setting Keyboard Autorepeat Rate
.Pp
The following example sets the keyboard autorepeat rate:
.Pp
.Dl example% kbd -R 50
.Dl example%
.El
.Bl -ohang
.It Sy Example 6 Selecting and Setting the Keyboard Language
.Pp
The following example selects and sets the keyboard language from a list of
languages specified:
.Pp
.Bd -literal -offset indent -compact
example% kbd -s
1. Albanian                      16. Malta_UK
2. Belarusian                    17. Malta_US
3. Belgian                       18. Norwegian
4. Bulgarian                     19. Portuguese
5. Croatian                      20. Russian
6. Danish                        21. Serbia-And-Montenegro
7. Dutch                         22. Slove
\&......

To select the keyboard layout, enter a number [default n]:

example%
.Ed
.Pp
The following example sets the keyboard language specified:
.Pp
.Dl example% kbd -s Dutch
.Dl example%
.El
.Bl -ohang
.It Sy Example 7 Setting the Keyboard Beeper Frequency
.Pp
The following example sets the keyboard beeper frequency:
.Pp
.Dl example% kbd -b keyboard 1000
.Dl example%
.El
.Sh SEE ALSO
.Xr loadkeys 1 ,
.Xr svcs 1 ,
.Xr asy 4D ,
.Xr se 4D ,
.Xr virtualkm 4D ,
.Xr zs 4D ,
.Xr kb 4M ,
.Xr keytables 5 ,
.Xr attributes 7 ,
.Xr smf 7 ,
.Xr kadb 8 ,
.Xr pppd 8 ,
.Xr svcadm 8
.Sh NOTES
Some server systems have key switches with a
.Sy secure
key position that can be read by system software.
This key position overrides the normal default of the keyboard abort sequence
effect and changes the default so the effect is disabled.
When the key switch is in the
.Sy secure
position on these systems, the keyboard abort sequence effect cannot be
overridden by the software default, which is settable with the
.Nm
utility.
.Pp
Currently, there is no way to determine the state of the keyboard click
setting.
.Pp
The
.Nm
service is managed by the service management facility,
.Xr smf 7 ,
under the service identifier:
.Pp
.Dl svc:/system/keymap:default
.Pp
Administrative actions on this service, such as enabling, disabling, or
requesting restart, can be performed using
.Xr svcadm 8 .
Use
.Xr svccfg 8
to make configuration changes and to view configuration information for this
service.
The service's status can be queried using the
.Xr svcs 1
command.
